<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>个人信息</title>
	<meta name="renderer" content="webkit">	
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">	
	<meta name="apple-mobile-web-app-status-bar-style" content="black">	
	<meta name="apple-mobile-web-app-capable" content="yes">	
	<meta name="format-detection" content="telephone=no">	
	<link rel="stylesheet" type="text/css" href="common/layui/css/layui.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
	<link rel="stylesheet" type="text/css" href="common/global.css" media="all">
	<link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
</head>
<body>
<section class="layui-larry-box">
	<div class="larry-personal">
		<header class="larry-personal-tit">
			<span>个人信息</span>
		</header><!-- /header -->
		<div class="larry-personal-body clearfix">
			<form class="layui-form col-lg-5" action="" method="post" id="ad_info">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">  
						<input type="text"id="admin_acc" name="title"  autocomplete="off"  class="layui-input layui-disabled" value="" disabled="disabled" >
						<input type="text"id="admin_acc1" name="account"  autocomplete="off"  class="layui-input layui-disabled" value="" hidden="hidden" >
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">邮箱账号</label>
					<div class="layui-input-block">
						<input type="text" id="admin_email" name="username"  autocomplete="off" class="layui-input layui-disabled" value="" disabled="disabled">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">真实姓名</label>
					<div class="layui-input-block">
						<input type="text" id="admin_name" name="name"  autocomplete="off" class="layui-input" value="Larry">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">手机号码</label>
					<div class="layui-input-block">
						<input type="text" id="admin_phonenum" name="phonenum"  autocomplete="off" class="layui-input" placeholder="输入手机号码">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">性别</label>
					<div class="layui-input-block">
						<input type="radio" id="admin_sex1" name="sex" value="男" title="男" checked="false"><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><span>男</span></div>
						<input type="radio" id="admin_sex2" name="sex" value="女" title="女" checked="true"><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon"></i><span>女</span></div>
					</div>
				</div>

				<!--<div class="layui-form-item">
					<label class="layui-form-label">修改头像</label>
					<div class="layui-input-block">
						<input type="file" name="file" class="layui-upload-file">
					</div>
				</div>-->


				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">座右铭</label>
					<div class="layui-input-block">
						<textarea id="admin_motto" name="motto" placeholder="既然选择了远方，便只顾风雨兼程；路漫漫其修远兮，吾将上下而求索" value="" class="layui-textarea"></textarea>
					</div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" type="button" onclick="updataadinfo()" lay-filter="demo1">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>


	<script type="text/javascript">
		//document.getElementById("admin_sex2").checked=true;
	</script>

</section>
<script type="text/javascript" src="common/layui/lay/dest/layui.all.js"></script>
<script type="text/javascript" src="js/login.js"></script>
<script type="text/javascript" src="jsplug/jparticle.jquery.js"></script>
<script type="text/javascript" src="common/layui/layui.js"></script>
<script type="text/javascript" src="js/token.js"></script>
<script type="text/javascript">
	//给员工的赋值
	var account=sessionStorage.getItem("account");
	window.onload=function toseek(){
		$.post("/login/toseekadmin",{account:account},function (res){
			var ad_name;
			var ad_email;
			var ad_phone;
			var ad_sex;
			var ad_motto;
			ad_email=res.data.email;
			ad_name=res.data.name;
			ad_phone=res.data.phonenum;
			ad_sex=res.data.sex;
			ad_motto=res.data.motto;
			document.getElementById("admin_acc").value=account;
			document.getElementById("admin_name").value=ad_name;
			document.getElementById("admin_email").value=ad_email;
			document.getElementById("admin_motto").value=ad_motto;
			document.getElementById("admin_phonenum").value=ad_phone;
			//判断性别
			if (ad_sex=="男"){
				document.getElementById("admin_sex1").checked=true;
				layui.use(['form','upload'],function() {
					var form = layui.form();
					form.render();
				})
			}else {
				//重新绘制表单
				document.getElementById("admin_sex2").checked=true;
				layui.use(['form','upload'],function() {
					var form = layui.form();
					form.render();
				})
			}
		},"json")
	}

	//提交个人信息修改方法
	//将账号也传递获取(disabled会导致此文本框不传递)
	document.getElementById("admin_acc1").value=account;
	function updataadinfo(){
		$.post("/login/updataadinfo",$("#ad_info").serialize(),function (res) {
			layer.open({
				title: '成功'
				,content: '提交成功'
			});
		},"json")
	}


	layui.use(['form','upload'],function(){
         var form = layui.form();
         form.render();
         layui.upload({ 
             url: '' ,//上传接口 
             success: function(res){
              //上传成功后的回调 
              console.log(res) 
            } 
         });

	});
</script>
</body>
</html>